package com.changgou.goods.service.impl;

import com.changgou.goods.dao.CategoryMapper;
import com.changgou.goods.dao.TemplateMapper;
import com.changgou.goods.pojo.Category;
import com.changgou.goods.pojo.Template;
import com.changgou.goods.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author zhaoyang
 * @Date 2024/4/18 9:31
 */
@Service
public class TemplateServiceImpl implements TemplateService {

    @Autowired(required = false)
    private CategoryMapper categoryMapper;
    @Autowired(required = false)
    private TemplateMapper templateMapper;

    @Override
    public Template findByCategoryId(Integer id) {
        //查询分类信息
        Category category = categoryMapper.selectByPrimaryKey(id);

        //根据模板Id查询模板信息
        return templateMapper.selectByPrimaryKey(category.getTemplateId());
    }
}
